package com.github.bridge.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
public class OuterUserCreateAndSignatureDTO extends BaseDTO {

    @NotBlank(message = "用户不能为空")
    @Schema(description = "用户名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @Schema(description = "是否加密 默认false", defaultValue = "false")
    private Boolean encrypt;

    @NotBlank(message = "证件类型不能为空")
    @Schema(description = "个人身份证件类型，支持类型如下：" +
            "MAINLAND - 大陆身份证（15位或者17位+1位校验位）" +
            "HONGKONG - 香港居民往来内地通行证（字母H或者h开头，后接8位或者10位数字）" +
            "MACAO - 澳门居民往来内地通行证（字母M或者m开头，后接8位或者10位数字）" +
            "TAIWAN - 台湾居民来往大陆通行证（8位或者10位数字）" +
            "PASSPORT - 护照（e签宝校验规则：1-25位的大小写字母或者数字组合）" +
            "OTHER - 其他类型（不校验证件格式）", requiredMode = Schema.RequiredMode.REQUIRED)
    private String idNoType;

    @NotBlank(message = "证件号码不能为空")
    @Schema(description = "证件号码", requiredMode = Schema.RequiredMode.REQUIRED)
    private String idNo;

    @Schema(description = "印章模板类型 SQUARE-正方形印章 RECTANGLE-矩形印章 BORDERLESS-无框矩形印章 ", defaultValue = "SQUARE", allowableValues = {"SQUARE", "RECTANGLE", "BORDERLESS"}, requiredMode = Schema.RequiredMode.REQUIRED)
    private String type;

    @Schema(description = "生成印章的颜色 枚举：（1）RED，红色 （2）BLUE，蓝色 （3）BLACK，黑色", defaultValue = "RED", allowableValues = {"RED", "BLUE", "BLACK"}, requiredMode = Schema.RequiredMode.REQUIRED)
    private String color;

    @Schema(description = "印章是否加“印”规则 SEAL_NONE，无‘印’ SEAL_ONE，带‘印’ SEAL_TWO，带‘之印’", defaultValue = "SEAL_NONE", allowableValues = {"SEAL_NONE", "SEAL_ONE", "SEAL_TWO"}, requiredMode = Schema.RequiredMode.REQUIRED)
    private String stampRule;

    @Schema(description = "签章类型，<br/>" +
            "Single-单页签章 <br/>" +
            "Multi-多页签章 <br/>" +
            "Edges-签骑缝章 <br/>" +
            "Key-关键字签章 <br/>" +
            "【补充说明】：" +
            "关键字签章是全文检索合同中存在的文字，例如：keyWord=“甲方盖章”。就会在合同中检索存在“甲方盖章”这几个字的地方盖章", allowableValues = {"Single", "Multi", "Edges", "Key"}, requiredMode = Schema.RequiredMode.REQUIRED)
    private String signType;

    @Schema(description = "签署PDF文件信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private OuterUserSignatureDTO.FileParam fileBean;

    @Schema(description = "签章位置信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<OuterUserSignatureDTO.PosBean> posBeans;

    @Data
    public static class FileParam {
        @Schema(description = "文件名称 该文件名称会显示在套餐消费账单里，<br/> " +
                "后续对接方可以根据该名称和签署记录ID对账使用", requiredMode = Schema.RequiredMode.REQUIRED)
        private String fileName;

        @NotBlank(message = "fileKey不能为空")
        @Schema(description = "待签署文件fileKey", requiredMode = Schema.RequiredMode.REQUIRED)
        private String fileKey;
        @Schema(description = "文件编辑密码，当目标PDF设置权限保护时必填")
        private String password;
    }

    @Data
    public static class PosBean {
        @Schema(description = "签署页码（除关键字签章外，页码均不可为空）签署页码（除关键字签章外，页码均不可为空）</br>" +
                "若为多页签章，支持指定多个页码，例如格式：“1-3,5,8“")
        private String posPage;
        @Schema(description = "签署位置X坐标，默认0")
        private Float posX;
        @Schema(description = "签署位置Y坐标，默认0")
        private Float posY;
        @Schema(description = "关键字")
        private String keyWord;
        @Schema(description = "印章展现宽度，将以此宽度对印章图片做同比缩放。")
        private Float width;
        @Schema(description = "是否显示本地签署时间，需要width设置92以上才可以看到时间，时间格式：yyyy-MM-dd HH:mm:ss")
        private Boolean addSignTime;
    }

}
